package cn.brilliantfuture.commentry.entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * 
 * Title: Communication Entry
 * 
 * Author:  LiTian  
 *
 * Date: 2013-2-4
 * 
 * Description:
 * 
 */
@Entity
@Table(name = "storage_service_key", catalog = "cabinet")
public class StorageServiceKey implements java.io.Serializable{

	private static final long serialVersionUID = 1L;
	
	private Integer storageServiceKeyId;
	private String orderCode;
	private Purchaser purchaser;
	private Lockers lockers;
	private Integer groupId;
	private Date insertTime;
	private boolean enable = true;
	
	public StorageServiceKey() {
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "storage_service_key_id", unique = true, nullable = false)
	public Integer getStorageServiceKeyId() {
		return storageServiceKeyId;
	}

	public void setStorageServiceKeyId(Integer storageServiceKeyId) {
		this.storageServiceKeyId = storageServiceKeyId;
	}

	@Column(name = "order_code", nullable = false, length = 50)
	@NotNull
	@Length(max = 50)
	public String getOrderCode() {
		return orderCode;
	}

	public void setOrderCode(String orderCode) {
		this.orderCode = orderCode;
	}

	@ManyToOne
	@JoinColumn(name = "purchaser_id")
	public Purchaser getPurchaser() {
		return purchaser;
	}

	public void setPurchaser(Purchaser purchaser) {
		this.purchaser = purchaser;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "lockers_id")
	public Lockers getLockers() {
		return lockers;
	}

	public void setLockers(Lockers lockers) {
		this.lockers = lockers;
	}

	@Column(name = "group_id", nullable = false)
	public Integer getGroupId() {
		return groupId;
	}

	public void setGroupId(Integer groupId) {
		this.groupId = groupId;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "insert_time", nullable = false, length = 19)
	@NotNull
	public Date getInsertTime() {
		return insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}

	@Column(name = "enable", nullable = false)
	public boolean isEnable() {
		return enable;
	}

	public void setEnable(boolean enable) {
		this.enable = enable;
	}

	
}
